//
//  YFBaseServer.h
//  techand-iOS
//
//  Created by Yutian Duan on 16/7/16.
//  Copyright © 2016年 techand. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "YFRequestManager.h"
#import "Result.h"
#import "RequestUrl.h"

// 请求block
typedef void (^BaseServer) (BOOL finish);
typedef void (^BaseServerError) (NSError *error);

typedef void (^FinishedBlock) (Result *returnValue);
typedef void (^FailedBlock) (id errorCode);

@interface YFBaseServer : NSObject

@property (copy, nonatomic) BaseServer comletionBlock;
@property (copy, nonatomic) BaseServerError completionErrorBlock;

/**
 * @brief 初始化
 */
+ (instancetype)sharedInstance;

- (void)startHTTPWithMethod:(YFRequestMethod)method
                     params:(NSDictionary *)params
                        key:(NSString *)key
                   finished:(FinishedBlock)finishedBlock
                     failed:(FailedBlock)failedBlock;

- (void)postDataWithParams:(NSDictionary *)params
                  andDatas:(NSArray *)dataArray
                    toFile:(NSArray *)fileArray
                       key:(NSString *)key
                  finished:(FinishedBlock)finishedBlock
                    failed:(FailedBlock)failedBlock;


- (NSDictionary *)params:(NSDictionary *)params;

///! 获取环境
- (NSString *)langKey;

@end
